using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using YayiMgr.Ability.Docking.PatientApp;
using YayiMgr.Ability.Docking.PatientApp.Dto;

namespace YayiMgr.Web.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class PatientsController : ControllerBase
    {
        public IPatientsServicer PatientsSvr { get; set; }

        [HttpGet]
        public async Task<List<PatientsDto>> Get()
        {
            return await PatientsSvr.GetAllPatients();
        }

   
        [HttpGet("{id}")]
        public async Task<PatientsDto> Get(Guid id)
        {
            return await PatientsSvr.GetPatientsById(id);
        }


        [HttpPost]
        public async Task<PatientsDto> Post(PatientsCreateDto input)
        {
            return await PatientsSvr.AddPatients(input);
        }


        [HttpPut("{id}")]
        public async void Put(Guid id, PatientsUpdateDto input)
        {
            await PatientsSvr.UpdatePatients(id,input);
        }


        [HttpDelete("{id}")]
        public async void Delete(Guid id)
        {
            await PatientsSvr.DeletePatients(id);
        }
    }
}